#include "head.h"


float get_cpu_clock_speed ( )
{
	FILE * fp;
	char buffer[1024];
	size_t bytes_read;
	char * match;
	float clock_speed;

	fp = fopen("/proc/cpuinfo", "r");
	bytes_read = fread ( buffer, 1, sizeof (buffer), fp );
	fclose (fp);

	buffer[bytes_read] = '\0';

	match = strstr ( buffer, "cpu MHz" );

	sscanf ( match, "cpu MHz : %f", &clock_speed ) ;

	return clock_speed ;
}


